package com.edu.cold.druid.controller;

import com.edu.cold.common.utils.Result;
import com.edu.cold.druid.service.DruidService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 * Druid管理类
 * </p>
 *
 * @author jpge
 * @since 2024-04-05
 */
@Slf4j
@RestController
@RequestMapping("apache-druid/query")
public class DruidController {

    /**
     *
     */
    @Resource
    private DruidService druidService;


    /**
     * 查询Druid中数据列表
     */
    @RequestMapping(value = "/select")
    public Result Select(@RequestParam Map<String, Object> params) {
        return druidService.queryDruidList(params);
    }

    /**
     * 查询Druid中温度湿度数据（设备最近10条数据）
     *
     * @param params
     * @return
     */
    @RequestMapping("/temhum")
    public Result temhumLine(@RequestParam Map<String, Object> params) {
        return druidService.queryDruidTumHum(params);
    }
}
